$def with (doc, lists, show_header=True)

$ deleteType = ''

$if show_header:
    <div id="contentHead">
        $ header = render_template("lists/header", doc, lists)
        $var title: $_('%(owner)s / Lists', owner=header.title)
        $:header
    </div>

$if doc.key.startswith("/subjects/"):
    $ seed = doc.get_seed()
$else:
    $ seed = {"key": doc.key}

$ deleteType = ''

$if "type" in doc and doc.type.key == "/type/user":
    <style type="text/css">
        span.list-owner { display: none; }
    </style>
    $if ctx.user and ctx.user.key == doc.key:
        $ deleteType = 'deleteList'
        $# The link below is a placeholder that gets inserted into the correct place in the DOM on page load via ListViewBody.js
        <span class="listDelete sansserif smaller listDelete--myLists hidden">
            <a href="javascript:;" data-confirm-text="$:_('Yes, I\'m sure')" data-cancel-text="$_('No, cancel')"><span></span>$_('Delete this list')</a>
        </span>
        <div id="delete-list-dialog" class="hidden" title="$_('Delete list')">$_('Are you sure you want to delete this list?')</div>
$else:
    $ deleteType = 'deleteSeed'
    $# The link below is a placeholder that gets inserted into the correct place in the DOM on page load via ListViewBody.js
    <span class="listDelete sansserif smaller seedDelete--myLists hidden">
        <a href="javascript:;" data-confirm-text="$:_('Yes, I\'m sure')" data-cancel-text="$_('No, cancel')"><span></span>$_('Remove this seed?')</a>
    </span>
    <div id="remove-seed-dialog" class="hidden" title="$_('Remove')">$:_('Are you sure you want to remove <strong>%(title)s</strong> from this list?', title=header.title)</div>

$def seed_attrs(seed):
  data-list-key="$list.key"

<div id="contentBody">
    $if lists:
        <div class="mybooks-list">
            <ul class="list-results" id="listResults">
            $for list in lists:
                <li class="searchResultItem $deleteType"
                    id="list-$loop.index" $:seed_attrs(seed)>$:render_template("lists/preview", list)</li>
            </ul>
        </div>
    $elif not ctx.user or ctx.user.key != doc.key:
        <p>$_("This reader hasn't created any lists yet.")</p>
    $else:
        <p>$_("You haven't created any lists yet.")</p>
        <p>
          <a href="/help/faq/reading-log#lists"
               target="_blank">$_('Learn how to create your first list.')</a>
        </p>
    <div class="clearfix"></div>

    <h2>$_('Recent Activity')</h2>
    $:render_template("lists/activity", doc)
</div>
